package com.sk.client.level2;


import com.alibaba.fastjson.JSON;
import com.sk.common.level2.rpcInterface.CalculateRpcInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * description：
 *
 * @author 孙文斌
 * @Date: 2021/1/26 14:20
 */
@RestController
@RequestMapping(value = "/client")
public class ClientControllerL2 {

    @Autowired
    private CalculateRpcInterface calculateRpcInterface;

    @RequestMapping(value = "/add",method = RequestMethod.GET,produces = "application/json;charset=utf-8")
    public String add(@RequestParam("v1") Integer v1,@RequestParam("v2") Integer v2){
        String s = null;
        for (int i=1;i<3;i++){
            Object result = calculateRpcInterface.add(v1, v2);
            s = JSON.toJSONString(result);
        }
        return s;
    }
}
